package com.ruoyi.project.system.controller;

import java.util.List;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.project.system.domain.SysHouseDecorationMoment;
import com.ruoyi.project.system.service.ISysHouseDecorationMomentService;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.framework.web.page.TableDataInfo;

/**
 * 整屋装修视频Controller
 * 
 * @author jjp
 * @date 2020-04-26
 */
@RestController
@Api("整屋装修视频")
@RequestMapping("/system/decorationMoment")
public class SysHouseDecorationMomentController extends BaseController
{
    @Autowired
    private ISysHouseDecorationMomentService sysHouseDecorationMomentService;

    /**
     * 查询整屋装修视频列表
     */
    @PreAuthorize("@ss.hasPermi('system:moment:list')")
    @ApiOperation("查询整屋装修视频列表")
    @GetMapping("/list")
    public TableDataInfo list(SysHouseDecorationMoment sysHouseDecorationMoment)
    {
        startPage();
        List<SysHouseDecorationMoment> list = sysHouseDecorationMomentService.selectSysHouseDecorationMomentList(sysHouseDecorationMoment);
        return getDataTable(list);
    }

    /**
     * 获取整屋装修视频详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:moment:query')")
    @ApiOperation("获取整屋装修视频详细信息")
    @GetMapping(value = "/{houseDecorationMomentId}")
    public AjaxResult getInfo(@PathVariable("houseDecorationMomentId") Long houseDecorationMomentId)
    {
        return AjaxResult.success(sysHouseDecorationMomentService.selectSysHouseDecorationMomentById(houseDecorationMomentId));
    }

    /**
     * 新增整屋装修视频
     */
    @PreAuthorize("@ss.hasPermi('system:moment:add')")
    @ApiOperation("新增整屋装修视频")
    @Log(title = "整屋装修视频", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody SysHouseDecorationMoment sysHouseDecorationMoment)
    {
        return toAjax(sysHouseDecorationMomentService.insertSysHouseDecorationMoment(sysHouseDecorationMoment));
    }

    /**
     * 修改整屋装修视频
     */
    @PreAuthorize("@ss.hasPermi('system:moment:edit')")
    @ApiOperation("修改整屋装修视频")
    @Log(title = "整屋装修视频", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody SysHouseDecorationMoment sysHouseDecorationMoment)
    {
        return toAjax(sysHouseDecorationMomentService.updateSysHouseDecorationMoment(sysHouseDecorationMoment));
    }

    /**
     * 删除整屋装修视频
     */
    @PreAuthorize("@ss.hasPermi('system:moment:remove')")
    @ApiOperation("删除整屋装修视频")
    @Log(title = "整屋装修视频", businessType = BusinessType.DELETE)
	@DeleteMapping("/{houseDecorationMomentIds}")
    public AjaxResult remove(@PathVariable Long[] houseDecorationMomentIds)
    {
        return toAjax(sysHouseDecorationMomentService.deleteSysHouseDecorationMomentByIds(houseDecorationMomentIds));
    }
}
